<?php
namespace app\model;

class Items extends Base
{
	protected $name = 'items';

    public function getCateTextAttr($value,$data){
        $cate_id = $data['cate_id'];
        $cate = ItemsCate::column('id,cate_name');
        return $cate[$cate_id];
    }

    public function getGoodsUrlAttr($value,$data){
        return url('wechat/Items/detail',['id',$data['id']]);
    }

    public function getTkMoneyAttr($value,$data){
        return round($data['tk_rate']*$data['price']*0.01,2);
    }

    public function getEndTimeAttr($value,$data){
        return date('Y m d',$data['coupon_end_time']);
    }
}